﻿using Microsoft.Extensions.Configuration;

namespace WXWorkSvc.Private;

public class WXWorkConfig
{
    public const string SectionName = "WXWork";

    public string ApplicationUrl { get; set; } = default!;
    public int AgentId { get; set; }
    public string CorpId { get; set; } = default!;

    public WXWorkConfig()
    {
    }
    public WXWorkConfig(IConfiguration configuration)
    {
        var c = configuration.GetSection(SectionName).Get<WXWorkConfig>();
        if (c == null)
            throw new Exception("请在 appsettting.json 设置 WXWork");
        ApplicationUrl = c.ApplicationUrl;
        AgentId = c.AgentId;
        CorpId = c.CorpId;
    }
    //public string Secret { get; set; } = default!;

    //public override string ToString()
    //{
    //    return $"{AgentId}{CorpId}{Secret}";
    //}
}
